package com.wc.AlgoOJ.DS0502_合并数列;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/1 19:04
 * @description http://43.138.190.70:8888/p/DS0502
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 20010;
    static int[] k = new int[N];
    static int[] b = new int[N];
    static int[] a = new int[N];
    static int n, m;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            k[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        m = sc.nextInt();
        int l = 1, r = (int) 1e8;
        while (l < r) {
            int mid = l + r >> 1;
            if (check(mid)) r = mid;
            else l = mid + 1;
        }
        // 求出的l为最大值
        int len = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; ; j++) {
                int val = k[i] * j + b[i];
                if (val <= l) {
                    a[len++] = val;
                } else {
                    break;
                }
            }
        }
        Arrays.sort(a, 0, len);
        for (int i = 0; i < m; i++) {
            out.print(a[i]);
            out.print(' ');
        }
        out.flush();
    }

    static boolean check(int mid) {
        long num = 0;
        for (int i = 0; i < n; i++) {
            if (mid >= b[i]) num += (mid - b[i]) / k[i] + 1;
        }
        return num >= m;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
